<?php

/**
 * Photoservice form.
 *
 * @package    sf_sandbox
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfPropelFormTemplate.php 10377 2008-07-21 07:10:32Z dwhittle $
 */
class PhotoserviceForm extends BasePhotoserviceForm
{
  public function configure()
  {
  	
  	if($this->object->getId()>0)
  	{
  	 $this->setWidgets(array(
      'id'          => new sfWidgetFormInputHidden(),
  	 'name'        => new sfWidgetFormInput(),
  	   'width'        => new sfWidgetFormInput(),
  	  'height'        => new sfWidgetFormInput(),
      
  	  'name1'        => new sfWidgetFormInput(),
      'file_path1'  => new inputImageTag (  array (), array('mat_id'=>$this->object->getId(),'folder'=>'photo_service') ),
  	  'name2'        => new sfWidgetFormInput(),
      'file_path2'  => new inputImageTag (  array (), array('mat_id'=>$this->object->getId(),'folder'=>'photo_service') ),
  	  'name3'        => new sfWidgetFormInput(),
      'file_path3'  => new inputImageTag (  array (), array('mat_id'=>$this->object->getId(),'folder'=>'photo_service') ),
  	  'name4'        => new sfWidgetFormInput(),
      'file_path4'  => new inputImageTag (  array (), array('mat_id'=>$this->object->getId(),'folder'=>'photo_service') ),
  	  'name5'        => new sfWidgetFormInput(),
      'file_path5'  => new inputImageTag (  array (), array('mat_id'=>$this->object->getId(),'folder'=>'photo_service') ),
  	  'name6'        => new sfWidgetFormInput(),
      'file_path6'  => new inputImageTag (  array (), array('mat_id'=>$this->object->getId(),'folder'=>'photo_service') ),
  	  'name7'        => new sfWidgetFormInput(),
      'file_path7'  => new inputImageTag (  array (), array('mat_id'=>$this->object->getId(),'folder'=>'photo_service') ),
  	  'name8'        => new sfWidgetFormInput(),
      'file_path8'  => new inputImageTag (  array (), array('mat_id'=>$this->object->getId(),'folder'=>'photo_service') ),
  	  'name9'        => new sfWidgetFormInput(),
      'file_path9'  => new inputImageTag (  array (), array('mat_id'=>$this->object->getId(),'folder'=>'photo_service') ),
  	  'name10'        => new sfWidgetFormInput(),
      'file_path10' => new inputImageTag (  array (), array('mat_id'=>$this->object->getId(),'folder'=>'photo_service') ),
  	  'name11'        => new sfWidgetFormInput(),
  	  'file_path11'  => new inputImageTag (  array (), array('mat_id'=>$this->object->getId(),'folder'=>'photo_service') ),
  	  'name12'        => new sfWidgetFormInput(),
      'file_path12'  => new inputImageTag (  array (), array('mat_id'=>$this->object->getId(),'folder'=>'photo_service') ),
  	  'name13'        => new sfWidgetFormInput(),
      'file_path13'  => new inputImageTag (  array (), array('mat_id'=>$this->object->getId(),'folder'=>'photo_service') ),
  	  'name14'        => new sfWidgetFormInput(),
      'file_path14'  => new inputImageTag (  array (), array('mat_id'=>$this->object->getId(),'folder'=>'photo_service') ),
  	  'name15'        => new sfWidgetFormInput(),
      'file_path15'  => new inputImageTag (  array (), array('mat_id'=>$this->object->getId(),'folder'=>'photo_service') ),
  	  'name16'        => new sfWidgetFormInput(),
      'file_path16'  => new inputImageTag (  array (), array('mat_id'=>$this->object->getId(),'folder'=>'photo_service') ),
  	  'name17'        => new sfWidgetFormInput(),
      'file_path17'  => new inputImageTag (  array (), array('mat_id'=>$this->object->getId(),'folder'=>'photo_service') ),
  	  'name18'        => new sfWidgetFormInput(),
      'file_path18'  => new inputImageTag (  array (), array('mat_id'=>$this->object->getId(),'folder'=>'photo_service') ),
  	  'name19'        => new sfWidgetFormInput(),
      'file_path19'  => new inputImageTag (  array (), array('mat_id'=>$this->object->getId(),'folder'=>'photo_service') ),
  	  'name20'        => new sfWidgetFormInput(),
      'file_path20' => new inputImageTag (  array (), array('mat_id'=>$this->object->getId(),'folder'=>'photo_service') ),

    ));
  	}
  	else 
  	{
  		$this->setWidgets(array(
      'id'          => new sfWidgetFormInputHidden(),
  		'name'        => new sfWidgetFormInput(),
  	  'width'        => new sfWidgetFormInput(),
  	  'height'        => new sfWidgetFormInput(),

  	  
    ));
  	}
    

    
        for ($i=1; $i<21; $i++)
        {
         $this->validatorSchema ['file_path'.$i] = new sfValidatorFile ( array ('required' => false, 
		'path' => sfConfig::get ( 'sf_web_dir' ) . '/uploads/material/photo_service', 
		'mime_types' => 'web_images', 'max_size' => 380000, // 360 kB
         ) );
        }
    

    	 $this->validatorSchema['width'] = new sfValidatorString(array('required' => true),array('required'=>'поле обязательно'));
    	  $this->validatorSchema['height'] = new sfValidatorString(array('required' => true),array('required'=>'поле обязательно'));
    	
    	    	
    	
    		$this->widgetSchema->setLabels ( array ('name' => 'Наименование', 
    	 'width'    => 'Ширина',
  		 'height'    => 'Высота',
		'file_path1'    => 'Файл 1',
  		'file_path2'    => 'Файл 2',
  		'file_path3'    => 'Файл 3',
  		'file_path4'    => 'Файл 4', 
		'file_path5'    => 'Файл 5', 
  		'file_path6'    => 'Файл 6', 
  		'file_path7'    => 'Файл 7', 
        'file_path8'    => 'Файл 8', 
    	'file_path9'    => 'Файл 9', 	
    	'file_path10'    =>'Файл 10', 
    		'file_path11'    =>'Файл 11', 
    		'file_path12'    =>'Файл 12', 
    		'file_path13'    =>'Файл 13', 
    		'file_path14'    =>'Файл 14', 
    		'file_path15'    =>'Файл 15', 
    		'file_path16'    =>'Файл 16', 
    		'file_path17'    =>'Файл 17', 
    		'file_path18'    =>'Файл 18', 
    		'file_path19'    =>'Файл 19', 
    		'file_path20'    =>'Файл 20', 
  		 ));	

  		 $this->validatorSchema->setOption ( 'allow_extra_fields', true );
  		 $this->widgetSchema->setNameFormat('photoservice[%s]');
  	
  }
}
